//
//  QJMineHeaderView.m
//  QuanJieShopProject
//
//  Created by apple on 2018/2/2.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "QJMineHeaderView.h"

@implementation QJMineHeaderView
- (IBAction)mineHeaderBtnClickAction:(UIButton *)sender {
    NSInteger tag = sender.tag;
    if (self.headerBtnClikBlock) {
        self.headerBtnClikBlock(tag);
    }
}
//user_type =1  是 泉界会员，2 是泉界创客，3，是泉界商家
- (void)headerUpdateWithModel:(UserInfoModel *)model{
    self.mineHeaderImage.layer.cornerRadius = 40.0;
    self.mineHeaderImage.layer.masksToBounds = YES;
    if (!model) {
        self.mineHeaderImage.image = KImageName(@"noHeaderImage");
        self.mineHeaderLabel.text = @"登录 | 注册";
    }else{
        [self.mineHeaderImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",NET_BASEURL,model.avatar]] placeholderImage:[UIImage imageNamed:@"noHeaderImage"]];
        NSString *typeStr;
        if ([model.user_type isEqualToString:@"1"]) {
            
            typeStr = @"泉界会员";
        }else if ([model.user_type isEqualToString:@"2"]){
            
            typeStr = @"泉界创客";
        }else if ([model.user_type isEqualToString:@"3"]){
            
            typeStr = @"泉界商家";
        }
        if (model.user_nickname == nil) {
            self.mineHeaderLabel.text = [NSString stringWithFormat:@"%@\n%@",model.mobile,typeStr];
        }else{
             self.mineHeaderLabel.text = [NSString stringWithFormat:@"%@\n%@",model.user_nickname,typeStr];
        }
       
    }
}


@end
